[Statedef -3]

; ---------------------------------------------------------
;   ----- Uno Tag System v.2.5 STATEDEF -3 Override -----
; ---------------------------------------------------------
;
; Uno Tag System ver.2.5 by UnoShe
; - PLEASE GIVE CREDIT IF MODIFYING THIS..

[State -3, enterTheScreen]
type = ChangeState
triggerall = Numpartner
trigger1 = var(51)
trigger1 = stateno = [4912,4914]	
trigger1 = Life 
trigger1 = (partner, stateno = 4911) || (partner, stateno = 4925 && partner, time > 0)
value = 4901

; Appear into the screen (Tag Hyper Cancel)
[State -3, enterTheScreen]
type = ChangeState
triggerall = Numpartner
trigger1 = var(51)
trigger1 = stateno = 4912 || stateno = 4914
trigger1 = (partner, stateno = 4927 && partner, time > 1) || (partner, prevstateno = 4927)
trigger1 = Life
value = 4931

; Jump into the screen (Change Attack)
[State -3, enterTheScreen]
type = ChangeState
triggerall = Numpartner
triggerall = var(51)
trigger1 = stateno = 4912 || stateno = 4914
trigger1 = (partner, stateno = 4926 && partner, time > 0)
trigger1 = Life
value = 4902

; Jump into the screen (Game is OVER)
[State -3, enterTheScreen]
type = ChangeState
triggerall = var(51)
triggerall = NumPartner
triggerall = Life
triggerall = StateNo = [4912,4914]
trigger1 = roundstate >= 3
trigger1 = Win || LoseTime || WinTime || drawgame
value = 4920

[State -3, NoJC]
type = AssertSpecial
trigger1 = prevstateno = [4912,4933]
flag = nojugglecheck
ignorehitpause = 1

[State -3, RemoveExplod]
type = Null
trigger1 = StateNo = [4910,4913]
trigger2 = !Life

[State -3, cancelfx]
type = Null
triggerall = Time = [0,6]
trigger1 = StateNo = 4902 || StateNo = 4926
time = ifelse(StateNo = 4902,3,6)
add = (25 + Time*3), (25 + Time*3), (655 - Time*5)
mul = 250, 250, (125 + Time)
sinadd =-245, -245, -250, (40 + Time*3)

[State -3, Quiet]
type = AssertSpecial
trigger1 = NumPartner
trigger1 = Partner, var(51) = 7
trigger1 = !Alive && !NumHelper(4930)
flag = nokosnd

[State -3, Dark]
type = AssertSpecial
triggerall = NumPartner
trigger1 = StateNo = 4906
trigger2 = Stateno = 4927 || Partner, Stateno = 4927
trigger3 = NumHelper(4901) || StateNo = 4931
flag = noBG
flag2 = noFG
flag3 = timerfreeze
ignorehitpause = 1

[State -3, InvertBG]
type = Null;AllPalFx
trigger1 = NumHelper(4930)
time = 2
invertall = 0
color = 225

[State -3, Invert]
type = Null
trigger1 = PrevStateNo = [4928,4929]
trigger2 = Stateno = 4906 && !NumHelper(4907)
time = 10
invertall = 1
mul = 200, 200, 200

[State -3, SuperPause]
type = SuperPause
triggerall = NumPartner
trigger1 = Partner, StateNo = 4906
trigger1 = NumHelper(4930)
trigger2 = NumHelper(4901)
time = 10
anim = -1
sound = -1
movetime = 10
darken = 0
p2defmul = 0
unhittable = 1
pausebg = 1

[State -3, TargetVelAdd]
type = TargetVelAdd
triggerall = NumPartner
triggerall = Numtarget
trigger1 = !(Target, StateNo = [4916,4917]) && !(Target, PrevStateNo = [4916,4917])
trigger1 = Roundstate = 2
trigger1 = prevstateno = 4926
trigger1 = partner, stateno = 4902 && !(partner, movecontact)
trigger1 = target, statetype != A && target, GetHitVar(xvel) < 0
x = 0.15

;-- Enable CA again..
[State -2, def]
type = VarSet
triggerall = var(51) = 9
trigger1 = Numtarget = 0
trigger2 = Time >= 9 * TicksPerSecond
v = 51
value = 1

[State -3, No AirGuard]
type = AssertSpecial
triggerall = Numpartner
trigger1 = var(51) = 8
trigger1 = Movetype = A
trigger1 = prevstateno = 4933
flag = Noairguard
flag2 = nojugglecheck
flag3 = nowalk
ignorehitpause = 1

[State -3, Can't be throw]
type = Nothitby
trigger1 = Numpartner
trigger1 = var(51) = 8
trigger1 = stateno != 4912 || stateno != 4914
value = , AT

[State -3, leavethem]
type = ChangeState
triggerall = var(51) = 8
triggerall = StateType != A
triggerall = Numpartner
trigger1 = Roundstate = 2
trigger1 = Life && partner, life
trigger1 = Partner, Stateno != [4901,4935]
trigger1 = MoveType = I || StateNo = [5100,5950]
trigger1 = Stateno != [1000,4999]
value = ifelse(((prevstateno=[5000,5950]) || (anim=[5000,5950])),4911,4910)
ctrl = 0

[State -3, leaveIntro]
type = ChangeState
triggerall = var(51) = 5
trigger1 = Numpartner
trigger1 = Roundstate >= 2
trigger1 = Stateno != [1000,4999]
value = 4910
ctrl = 0

[State -3, fromdark]
type = helper
trigger1 = Var(51) = 7 && !NumHelper(4939)
trigger1 = PrevStateNo = 4906 || StateNo = 5300
trigger1 = Time <= 25
helpertype = Normal
ID = 4939
stateno = 4930
name = "dark"
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State -3, Buwelo]
type = PosFreeze
trigger1 = Prevstateno = 4902
trigger1 = var(51) = 9
trigger1 = (Anim != [42,45])
trigger1 = Time <= 6
trigger1 = Numpartner
trigger1 = StateType = A 
trigger1 = MoveType = A

[State -3, sb_PA]
type = ScreenBound
trigger1 = Numpartner
trigger1 = var(51) = 8
value = ifelse(MoveType = A,1,0)

[State -3, No Ctrl]
type = CtrlSet
triggerall = Numpartner
trigger1 = stateno != [4911,4914]
trigger1 = var(51) = 8
value = ifelse((Partner, Alive),0, 1)

[State -3, Interrupt_PA]
type = ChangeState
triggerall = var(51) = 8
triggerall = NumPartner
trigger1 = stateno != [4900,4999]
trigger1 = prevstateno = [5000,5500]
trigger1 = movetype != H
trigger1 = partner, life > 0 && !Win && !Lose
value = 4911

[State -3, Party]
type = CtrlSet
triggerall = NumPartner
trigger1 = Partner, stateno != [4910,4913]
trigger1 = Partner, var(51) = 2
trigger1 = Movetype != A
trigger1 = prevstateno != [5000,5500]
value = ifelse((partner, movetype = A), 0, Cond((prevstateno = [4932,4931]) || (partner, stateno = 4925),0,1))

[State -3, PartyDone]
type = CtrlSet
triggerall = NumPartner
triggerall = !Ctrl
triggerall = Movetype != A
triggerall = stateno != [1000,5600]
trigger1 = prevstateno = [5000,5600]
trigger1 = Partner, var(51) = 2
trigger2 = Partner, Stateno = 4911
trigger2 = Partner, var(51) = 2
value = 1

[State -3, fadeOut]
type = Null
triggerall = NumPartner
trigger1 = !Life && Partner, Life
trigger1 = Partner, var(51)
trigger1 = RoundState = 2
trigger1 = StateNo = [5110,5150]
trigger1 = Time < ifelse((Partner,var(51) = 7),128,256)
trans = addalpha
alpha = 256-Cond((Partner,var(51) = 7),(time *3),time*2), time*time

[state -3, dead_var]
type = varset
triggerall = NumPartner
triggerall = !Alive
triggerall = RoundState = 2
triggerall = StateNo = [5110,5150]
trigger1 = Partner, Var(51)
trigger1 = time >= 128
trigger2 = Partner, Var(51)
trigger2 = Partner, var(51) = 7
trigger2 = time >= 85
v = 51
value = 6

[state -3, awake_var]
type = varset
triggerall = NumPartner
triggerall = roundstate = 2
trigger1 = Alive
trigger1 = var(51) = 6
trigger2 = Partner, Life
trigger2 = var(51) = 7
v = 51
value = 1

[state -3, offME]
type = NotHitBy
triggerall = NumPartner
trigger1 = var(51) = 6
trigger2 = StateNo = 4928 || PrevStateNo = 4928
trigger3 = Partner, var(51) = 6
trigger3 = StateNo = [4901,4933]
value = SCA

[state -3, disappear2]
type = ChangeState
trigger1 = RoundState = 2
trigger1 = StateNo = [5110,5149]
trigger1 = var(51) = 6
value = 4913

[state -3, Ghost]
type = AssertSpecial
triggerall = !Alive
triggerall = RoundState >= 2
triggerall = var(51) = 6
trigger1 = Anim = [5000,5600]
trigger2 = PrevStateNo = [4913,4921]
flag = invisible
flag2 = noshadow
ignorehitpause = 1

[State -3, drop]
type = TargetDrop
trigger1 = NumTarget
trigger1 = !Life

[State -3, EndLife]
type = LifeAdd
triggerall = RoundState = 2
trigger1 = PrevStateNo = 4929
trigger2 = Var(51) = 6
value = -LifeMax

; ------------------- UNO MODE --------------------
[State -3, Cursed]
type = LifeAdd
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = Stateno != 4906
trigger1 = !(Partner, Life)
trigger1 = (gametime%10) = 0
trigger1 = var(51) = 7
value = (-5 + Cond(Life < LifeMax/6, 3, 0))

[State -3, Cursed_2]
type = PowerAdd
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = Stateno != 4906
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
trigger1 = Power < PowerMax
trigger1 = MoveType != A
value = 100

[State -2, Cursed_3]
type = AttackMulSet
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
value = (1.5 + ((LifeMax/Life) * 0.015))

[State -3, Cursed_4]
type = DefenceMulSet
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
value = ifelse((Life>150),(0.2 - ((LifeMax/Life) * 0.015)),0.1)

[State -2, Cursed_5]
type = AssertSpecial
triggerall = NumPartner
trigger1 = RoundState = 2
trigger1 = MoveType = A
trigger1 = var(51) = 7
flag = nojugglecheck
flag2 = nowalk
ignorehitpause = 1

[State -3, Cursed_new1]
type = CtrlSet
triggerall = NumPartner
triggerall = RoundState = 2
triggerall = Numtarget
triggerall = StateNo != 4906
trigger1 = Target, StateNo != [200,4900]
trigger1 = (Partner, StateNo != [4928,4929]) && (Partner, PrevStateNo != [4928,4929])
trigger1 = var(51) = 7
trigger1 = Movetype = A
trigger1 = MoveContact
trigger1 = hitdefattr = SCA, NA, SA
trigger1 = hitcount < 6 && StateNo != PrevStateNo
trigger1 = Time > 3
trigger2 = Target, StateNo != [200,4900]
trigger2 = (Partner, StateNo != [4928,4929]) && (Partner, PrevStateNo != [4928,4929])
trigger2 = PrevStateNo = 4906
value = 1
ignorehitpause = 0

[State -3, Cursed_new2]	; Die if TIMEOVER!
type = LifeAdd
triggerall = NumPartner
trigger1 = RoundState > 2 && !Win
trigger1 = Stateno != 4906
trigger1 = !(Partner, Life)
trigger1 = var(51) = 7
value = -(Life)

[State -3, Cursed_effect1]
type = Null
trigger1 = NumPartner
trigger1 = Stateno != 4906
trigger1 = RoundState = 2
trigger1 = !Win && !Lose && !MatchOver && !DrawGame
trigger1 = !NumHelper(4907)
trigger1 = var(51) = 7
add=(50+Random*0.15),(50+Random*0.12),(50+Random*0.12)
mul = (90+Random*0.125), (90+Random*0.125), (90+Random*0.125)
sinadd=-255,-245,-245,(40 + Time*2)
time=10

[State -3, Cursed_effect2]
type = Null
triggerall = RoundState <= 2
triggerall = !Win && !Lose && !MatchOver && !DrawGame
triggerall = var(51) = 7
trigger1 = PrevStateNo = 5300 || PrevStateNo = 4600
trigger2 = (gametime%10) = 0
trans = add
PalContrast =  250, 250, 250
PalBright = 0,0,0
time    =  -1
length  = 17
TimeGap = 1
FrameGap = 1

[State -3, Cursed_effect2]
type = Null
triggerall = RoundState > 2
trigger1 = var(51) = 7
trigger2 = !Alive
time = 0

[State -3, Cursed_KOed]
type = SelfState
triggerall = var(51) = 7
trigger1 = !Life
trigger1 = StateType != A
trigger1 = StateNo != [5000,5600]
value = 5950
; ------------------------------------

[State -3, wait out of the stage]
type = ChangeState
triggerall = NumPartner
triggerall = RoundState = 2
triggerall = Life && Partner, Life	; And you're alive
triggerall = stateno != [4910,4913]
trigger1 = var(51) = 2            ; just performed team attack
trigger1 = (stateno != [1000,4999]) && (MoveType != H)
trigger2 = var(51) = 2            ; just performed team attack
trigger2 = (PrevStateNo = [5000,5500]) && (MoveType != H)
trigger3 = var(51) = 4            ; just performed Tag Cancel
trigger3 = (partner, prevstateno = 4931) && time > 1
trigger4 = var(51) = 3            ; just performed Shift Attack
trigger4 = (stateno = 4926 && time > 1) && (partner, stateno = 4902)
trigger5 = partner, stateno = 4903 && partner, time > 1
value = ifelse(var(51) = 4, 4912, 4911) 
ctrl = 0
ignorehitpause = 1

[State -3, Reset]
type = VarSet
trigger1 = StateNo != [4912, 4914]
var(55) = 0

[State -3, Reset]
type = VarSet
trigger1 = StateNo != [4912, 4914]
var(56) = 0

[State -3, Reset]
type = VarSet
trigger1 = StateNo != [4912, 4914]
var(57) = 0
; ---------- Uno Tag System v.2.5 END LINE Statedef -3 ----------
